
package xyz.zq.cloud.bs.api.feign.factory;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import xyz.zq.cloud.bs.api.feign.RemoteUserService;
import xyz.zq.cloud.bs.api.feign.fallback.RemoteUserServiceFallbackImpl;

/**
 * 远程用户服务回退工厂
 */
@Component
public class RemoteUserServiceFallbackFactory implements FallbackFactory<RemoteUserService> {

    @Override
    public RemoteUserService create(Throwable throwable) {
        RemoteUserServiceFallbackImpl remoteUserServiceFallback = new RemoteUserServiceFallbackImpl();
        remoteUserServiceFallback.setCause(throwable);
        return remoteUserServiceFallback;
    }
}
